include("shared.lua");
AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");
-- Setting up all the different properties of our melon.
ENT.Delay = 4;
ENT.Healthlol = 85;
ENT.FiringRange = 1000;
ENT.NoMoveRange = 50;
ENT.MinRange = 256;
ENT.DeathRadius = 75;
ENT.DeathMagnitude = 6;
ENT.MovingForce = 150;
ENT.MelonModel = "models/Combine_Helicopter/helicopter_bomb01.mdl";

-- Now we tell the base class to set up the melon. Pay attention - the variables must be defined BEFORE calling Setup().
function ENT:Initialize()
	self:Setup();
	self.Entity:SetMaterial("phoenix_storms/wire/pcb_red");
end
Sound ("Weapon_RPG.Single");

--What to do when we've found a target, and we've got the goahead to start attacking
function ENT:Attack ()
		local expl=ents.Create("lap_chaosrocket")
		local angle = self.Target:GetPos() - self.Entity:GetPos();
		local xr = math.Rand(0,0.2);
		local yr = math.Rand(0,0.2);
		local zr = math.Rand(0,0.2);
		local final = Vector (angle.x * (xr + 0.9), angle.y * (yr + 0.9), angle.z * (zr + 0.9));
		expl:SetPos(self.Entity:GetPos()+angle:Normalize()*10);
		expl:SetOwner(self.Entity);
		expl:SetAngles(final:Angle());
		expl:Spawn();
		expl:Activate();
		expl:GetPhysicsObject():SetVelocity(final:Normalize()*10000);
		local fx = EffectData();
		fx:SetOrigin(self.Entity:GetPos()+final:Normalize()*10);
		fx:SetAngle(final:Angle());
		fx:SetScale(2.5);
		util.Effect("MuzzleEffect", fx);
		self.Entity:EmitSound("Weapon_RPG.Single", 100, 100);
end